function x = suprarelaxare(A, b, x0, w,eps, maxiter)

	[m n]=size(A);	
	x=x0;    % x- este initializat cu aproximatia intiala a solutie;

	for k=1:maxiter
                
                % se calculeaza noul x
              	for i=1:n
		    suma1 = 0;
		    suma2 = 0;
                    for t=1:i-1
			    suma1 += A(i,t)*x(t);
		    endfor

		    for t=i+1:n
			    suma2 += A(i,t)*x0(t);
		    endfor

		    x(i)= -w*suma1/A(i,i) + (1-w)*x0(i) - w*suma2/A(i,i) + w*b(i)/A(i,i);
	      	endfor

		p=norm(x-x0);
        	q=norm(x);
               	if p<eps*q    % solutia a fost determinata cu precizie satisfacatoare
			break;
		endif
 		x0=x;    % aproximarea initiala devine noua aproximare a solutie
	endfor
	
endfunction
